
version 15
capture log close
set more off
clear
clear matrix
clear mata

if c(username)=="WB485280" {
		glo rootdir		"C:\Users\wb485280\OneDrive - WBG\radicalization"
		}
if c(username)=="WB382635" {
		glo rootdir		"C:\Users\wb382635\Dropbox\Unemp & daesh"
		}
if c(username)=="WB452275" {
		glo rootdir		"C:\Users\WB452275\Dropbox\Projects\Unemp & daesh"
		}
if c(username)=="sarurchaudhary" {
		glo rootdir		"/Users/sarurchaudhary/Dropbox/Unemp & daesh"
		}
if c(username)=="kartikabhatia" {
			glo rootdir		"/Users/kartikabhatia/Dropbox/Before2019/Unemp & daesh"
			}
			
		glo	datadir     "${rootdir}/Data/Raw data"
		glo outdir		"${rootdir}/Data/Working datasets"
		glo dodir		"${rootdir}/Dofiles"
        
		cd "${outdir}"
		
	    log using wages_prep, replace t
* ------------------------------------------------------------------------------
* Date : Nov 2017 [chkd oct 2021]


* Project : Mena Economic Monitor, Fall 2016 edition (MNACE, The World Bank)


* This do file prepares the wages database for merge

* Database used : country_educ_wages.dta


* Output : wages.dta

* ------------------------------------------------------------------------------


*                      ---------------------------
*                      ----------Wages Data-------
*                      ---------------------------


use "${datadir}/country_educ_wages.dta", clear
keep if year>=2007
rename education_levels education_level
drop if education_level==.a

* replacing year with 3 year lag/lead
gen     yearlag3=.
replace yearlag3=2013 if year>=2010 & year <=2013
replace yearlag3=2013 if year>=2014 & year<=2016

gen wage1lag3=mean_wage_edu if yearlag3==2013
lab var wage1lag3 "Median wage by education level"

gen wage2lag3=mean_wage_edu1 if yearlag3==2013
lab var wage2lag3 "Median wage by education level (18-36)"

*replacing year with 6 year lag/lead
gen     yearlag6=.
replace yearlag6=2013 if year>=2007 & year <=2013
replace yearlag6=2013 if year>=2014 & year<=2019

gen wage1lag6=mean_wage_edu if yearlag6==2013
lab var wage1lag6 "Median wage by education level"

gen wage2lag6=mean_wage_edu1 if yearlag6==2013
lab var wage2lag6 "Median wage by education level (18-36)"

keep countrycode education_level wage1lag3 wage2lag3 wage1lag6 wage2lag6


save "${outdir}/wages.dta", replace

log close
